Ext.define('Admin.view.role.manager.RoleManagerGrid', {
    extend: 'Ext.grid.Panel',
    xtype: 'roleManagerGrid',
    id: 'roleManagerGrid',

    title: '角色管理',
    iconCls: 'x-fa fa-edit',

    controller: 'roleManagerViewController',

    viewModel: {
        type: 'roleManagerViewModel'
    },

    bind: '{roles}',

    selModel: Ext.create('Ext.selection.CheckboxModel'),

    columns: [{
        header: 'id',
        dataIndex: 'id',
        width: 80,
        sortable: true,
        hidden: true
    }, {
        header: '角色名',
        dataIndex: 'role',
        width: 80,
        flex: 1,
        sortable: true
    }, {
        header: '操作',
        xtype: 'actioncolumn',
        cls: 'content-column',
        width: 100,
        flex: 1,
        text: '操作',
        items: [{
            xtype: 'button',
            iconCls: 'x-fa fa-edit',
            tooltip: '编辑',
            handler: 'onClickRoleManagerEditButton'
        }, {
            xtype: 'button',
            iconCls: 'x-fa fa-trash-o',
            tooltip: '删除',
            handler: 'onClickRoleManagerDeleteButton'
        }]
    }],

    tbar: Ext.create('Ext.toolbar.Toolbar', {
        items: [{
            xtype: 'textfield',
            reference: 'roleManagerQuery',
            emptyText: '角色名'
        }, {
            text: '重置',
            listeners: {
                click: 'onClickRoleManagerGridResetButton'
            }
        }, {
            text: '提交',
            listeners: {
                click: 'onClickRoleManagerGridSearchButton'
            }
        }]
    }),

    bbar: Ext.create('Ext.PagingToolbar', {
        bind: '{roles}',
        displayInfo: true,
        displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
        emptyMsg: "没有任何数据",
        items: ['-', {
            text: '增加',
            iconCls: 'x-fa fa-plus',
            listeners: {
                click: 'onClickRoleManagerAddUsersButton'
            }
        }, {
            text: '删除',
            iconCls: 'x-fa fa-trash-o',
            listeners: {
                click: 'onClickRoleManagerDeleteUsersButton'
            }
        }]
    })
});